// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
// import App from './App'
import App from './components/index'
import router from './router'
import vuex from 'vuex'
import promise from 'es6-promise';
import ElementUI from 'element-ui';
import axios from 'axios'
Vue.prototype.$axios = axios;
import echarts from 'echarts'

import fetch from './fetch/api'
Vue.prototype.$http = fetch.fetch;
axios.defaults.baseURL = process.env.baseUrl;

import commit from './fetch/common'
Vue.prototype.$commitHttp = commit.commitData;

import 'element-ui/lib/theme-chalk/index.css';
// easy-table 引入样式
import 'vue-easytable/libs/themes-base/index.css'
//导入审核流要用的样式和js
// import selector from './reviewFlow/js/selector.js'
// import dialogmin from './reviewFlow/js/dialog-min.js'
// import sea from './reviewFlow/js/sea.js'
// import common1 from './reviewFlow/js/common.js'
import appvoral from './reviewFlow/css/appvoralCSS.css'
import uidialog from './reviewFlow/css/ui-dialog.css'
//import uidialog from './reviewFlow/css/ui-dialog.css'

// easy-table 导入 table 和 分页组件
import {VTable,VPagination} from 'vue-easytable'
import common from './assets/js/common.js'
import vuexstore from './assets/js/vuexstore.js'
import cloneObj from './assets/js/cloneObj.js'
Vue.prototype.$cloneObj = cloneObj.deepClone;


//引用公共方法
Vue.prototype.$utils = require("./utils/index.js").default;
import math from 'mathjs'
math.config({
  number : 'BigNumber',
  precision : 64
})
Vue.prototype.$math = math
// 数据组装为树形结构
import listtotree from './assets/js/listtotree'
Vue.prototype.$listtotree = listtotree.listToTree;

import { AlertPlugin, ToastPlugin } from 'vux'

//公用函数工具
import util from '@/assets/js/util.js'
Vue.prototype.util = util;

Vue.use(AlertPlugin)
Vue.use(ToastPlugin)

//打印
import print from "./assets/js/print.js";
Vue.use(print);

import 'babel-polyfill'
promise.polyfill();

Vue.use(vuex);
// easy-table  注册到全局
// Vue.component(VTable.name, VTable)
// Vue.component(VPagination.name, VPagination)
Vue.use(ElementUI);
// Vue.use(common);
Vue.prototype.$common = common
Vue.prototype.$echarts = echarts

import VueJsonp from 'vue-jsonp'
// Vue.prototype.$jsonp = VueJsonp
Vue.use(VueJsonp)

const store = new vuex.Store(vuexstore)

Vue.config.productionTip = false

import {banBackSpace} from './assets/js/preventBackspace.js'

/* eslint-disable no-new */
new Vue({
  // el: '#app',
  el:'#app',
  router,
  store,
  components: { App },
  template: '<App/>',
  data:{
     eventHub:new Vue()   // 在main.js设置所有组件都能用调用
  },
  computed: {

  },
  mounted(){
    document.onkeypress=banBackSpace;
    document.onkeydown=banBackSpace;
  },
  created() {
    this.getCasAddress();
  },
  watch: {

  },
  methods:{
    getCasAddress() {
    	this.$http({
    		method: 'post',
    		apiUrl: '/getCasAddress.htm',
    	}).then(res => {
    		if (res.code == 0) {
    			localStorage.setItem('CasAddress', res.data);

    		}
    	}).catch((err) => {

    	});
    },
  }

})
